﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}

<!DOCTYPE html>




<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>供应商列表</title>
    <link href="~/lib/layui/css/layui.css" rel="stylesheet" />
    @* <script src="~/lib/layui/layui.js"></script> *@
    <script src="~/js/js.cookie.js"></script>
    <script src="~/js/moment.js"></script>
    <script src="~/lib/jquery/dist/jquery.js"></script>
    @* 导出引入文件 *@
    <title>Layui with XLSX</title>
    <!-- 引入Layui的CSS -->
    @* <link rel="stylesheet" href="path/to/layui.css"> *@
    <!-- 引入XLSX库的CDN -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
</head>
<body>
    <form class="layui-form" action="">
        <div class="layui-form">
            <div class="layui-form-item">
                <div class="layui-input-group">
                    <div class="layui-input-prefix">
                        出库单编号
                    </div>
                    <div>
                        <input id="sellStockNo" type="text" placeholder="请输入出库单编号" class="layui-input">
                    </div>

                    <div class="layui-input-prefix" style="left:50px">
                        销售订单编号
                    </div>
                    <div style="left:50px">
                        <input id="sellStockIndent" type="text" placeholder="请输入销售订单编号" class="layui-input">
                    </div>

                    <div class="layui-input-prefix" style="left:100px">
                        客户名称
                    </div>
                    <div style="left:100px">
                        <input id="clientName" type="text" placeholder="请输入客户名称" class="layui-input">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-group">
                    <div class="layui-input-prefix" style="left:14px">
                        出库日期
                    </div>
                    <dic style="left:14px">
                        <input style="width:198px" id="sellStockTime" type="date" placeholder="请输入客户名称" class="layui-input">
                    </dic>

                    <div class="layui-input-prefix" style="left:92px">
                        单据状态
                    </div>
                    <div style="left:92px;width:197px">
                        <select id="sellStockStart" lay-filter="testSelect">
                            <option value="-1">请选择单据状态</option>
                            <option value="0">草稿</option>
                            <option value="1">已确认</option>
                            <option value="2">审批中</option>
                            <option value="3">已审批</option>
                            <option value="4">已完成</option>
                        </select>
                    </div>

                    <div style="left:150px">
                        <button onclick="ShowSellStock()" id="searchBtn" type="button" class="layui-btn layui-btn-normal">搜索</button>
                    </div>

                    <div style="left:170px">
                        <button onclick="Break()" type="button" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-group">
                    <div>
                        <button type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-border-blue" lay-on="test-page-custom">
                            <i class="layui-icon layui-icon-add-1">新增</i>
                        </button>
                        <button type="button" class="layui-btn layui-bg-blue">导出</button>
                    </div>
                </div>
            </div>

            <table style="left:320px" class="layui-table">
                <thead>
                    <tr>
                        <td><input type="checkbox" name="checkAll" lay-filter="checkAll" /></td>
                        <td>出库单编号</td>
                        <td>出库单名称</td>
                        <td>销售订单编号</td>
                        <td>客户编码</td>
                        <td>客户名称</td>
                        <td>出库日期</td>
                        <td>单据状态</td>
                        <td>操作</td>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <div id="demo-laypage-all"></div>
        </div>
    </form>
    <script src="//unpkg.com/layui@2.9.18/dist/layui.js"></script>

    <script>
        var $ = layui.$;
        var layer = layui.layer;
        var util = layui.util;
        var form = layui.form;
        layui.use(function () {
            // 事件
            util.on('lay-on', {
                'test-page-custom': function () {
                    layer.open({
                        type: 1,
                        area: '100%',
                        resize: false,
                        shadeClose: true,
                        title: '添加销售出库单',
                        content: `
                        <form class="layui-form" action="">
                            <div class="layui-form" lay-filter="filter-test-layer" style="margin: 16px;">
                                <div class="demo-Add-container">
                                    <div class="layui-form-item">
                                        <div class="layui-input-group">
                                            <div class="layui-input-prefix" style="left:28px">
                                                出库单编号
                                            </div>
                                            <div style="width:300px;left:28px">
                                                <input style="width:300px" type="text" name="sellStockNo" value="" lay-verify="required" placeholder="请输入出库单编号" lay-reqtext="请填写出库单编号" autocomplete="off" class="layui-input" lay-affix="clear">
                                            </div>
                                            <div style="left:27px">
                                                <button type="button" class="layui-btn layui-btn-primary layui-btn-xs" onclick="nodeAlls()">自动生成</button>
                                            </div>
                                            <div class="layui-input-prefix" style="left:110px">
                                                出库单名称
                                            </div>
                                            <div style="width:300px;left:110px">
                                                <input style="width:300px" type="text" name="sellStockName" value="" lay-verify="required" placeholder="请输入出库单名称" lay-reqtext="请填写出库单名称" autocomplete="off" class="layui-input" lay-affix="clear">
                                            </div>
                                        </div>
                                    </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-group">
                                        <div class="layui-input-prefix" style="left:14px">
                                            销售订单编号
                                        </div>
                                        <div style="width:200px;left:14px">
                                            <input style="width:200px" type="text" name="sellStockIndent" value="" lay-verify="required" placeholder="请输入销售订单编号" lay-reqtext="请填写销售订单编号" autocomplete="off" class="layui-input" lay-affix="clear">
                                        </div>

                                        <div class="layui-input-prefix" style="left:20px">
                                            客户编码
                                        </div>
                                        <div style="width:150px;left:20px">
                                            <input style="width:150px" type="text" name="clientNos" value="" lay-verify="required" placeholder="请输入客户编码" lay-reqtext="请填写客户编码" autocomplete="off" class="layui-input" lay-affix="clear">

                                        </div>
                                        <div style="left:19px">
                                            <button type="button" class="layui-btn layui-btn-primary" lay-on="test-page-customs">
                                                <i class="layui-icon layui-icon-search"></i>
                                            </button>
                                        </div>

                                        <div class="layui-input-prefix" style="left:87px">
                                            客户名称
                                        </div>
                                        <div style="width:200px;left:82px">
                                            <input style="width:200px" type="text" name="clientNames" value="" lay-verify="required" placeholder="请输入客户名称" lay-reqtext="请填写客户名称" autocomplete="off" class="layui-input" lay-affix="clear">
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-group">
                                        <div class="layui-input-prefix" style="left:42px">
                                            出库日期
                                        </div>
                                        <div style="width:220px;left:43px">
                                            <input style="width:210px" type="date" name="sellStockTime" value="" lay-verify="required" placeholder="请输入出库日期" lay-reqtext="请填写出库日期" autocomplete="off" class="layui-input" lay-affix="clear">
                                        </div>

                                        <div class="layui-input-prefix" style="left:28px">
                                            单据状态
                                        </div>
                                        <div style="width:200px;left:28px">
                                            <select style="width:200px" name="sellStockStart" id="supplierClassId">
                                                <option value="0">草稿</option>
                                                <option value="1">已确认</option>
                                                <option value="2">审批中</option>
                                                <option value="3">已审批</option>
                                                <option value="4">已完成</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-group">
                                        <div class="layui-input-prefix" style="left:70px">
                                            备注
                                        </div>
                                        <div style="width:780px;left:72px">
                                            <textarea style="width:780px" type="textarea" name="sellStockRemark" value="" lay-verify="required" placeholder="请输入内容" lay-reqtext="请填写销售出库备注" autocomplete="off" class="layui-input layui-textarea" lay-affix="clear"></textarea>
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item" style="left:755px">
                                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="demo-Add">保存</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                            </div>
                        </form>
                        `,
                        success: function () {
                            // 对弹层中的表单进行初始化渲染
                            form.render();
                            // 表单提交事件
                            form.on('submit(demo-Add)', function (data) {
                                var field = data.field; // 获取表单字段值
                                //获取name数据
                                let first = {
                                    sellStockNo: $("[name='sellStockNo']").val(),
                                    sellStockName: $("[name='sellStockName']").val(),
                                    sellStockIndent: $("[name='sellStockIndent']").val(),
                                    clientId: localStorage.getItem("clientId"),
                                    sellStockTime: $("[name='sellStockTime']").val(),
                                    sellStockStart: $("[name='sellStockStart']").val(),
                                    sellStockRemark: $("[name='sellStockRemark']").val(),
                                    ProductsSaleId:0,
                                };
                                console.log("##!!!");
                                // 显示填写结果，仅作演示用
                                // layer.alert(JSON.stringify(field), {
                                //     title: '当前填写的字段值'
                                // });
                                // 此处可执行 Ajax 等操作
                                // …
                                $.ajax({
                                    url: '@ViewBag.FoundationWrite' + "/api/UserLi/CreateSellStock",
                                    data: JSON.stringify(first),
                                    type: "post",
                                    async: true,
                                    dataType: "json",
                                    contentType: "application/json",
                                    success: res => {
                                        if (res.code > 0) {
                                            alert('新增成功');
                                            layer.closeAll(); // 关闭当前弹层
                                        }
                                        else {
                                            alert('新增失败');
                                        }
                                    }
                                })
                                return false; // 阻止默认 form 跳转
                            });
                        }
                    });
                }
            })
        });
        //自动生成编码
        function nodeAlls() {
            var datec = new Date()
            var year = datec.getFullYear();
            var month = (datec.getMonth() + 1).toString().padStart(2, "0")
            var date = (datec.getDate() + 1).toString().padStart(2, "0")
            var hours = datec.getHours()
            var minute = (datec.getMinutes()).toString().padStart(2, "0")
            var seconds = (datec.getSeconds()).toString().padStart(2, "0")
            // var Encoding = "IF";
            var result = "IF" + year + month + date + hours + minute + seconds;
            console.log(result);
            $("[name='sellStockNo']").val(result);

            //重新渲染表单
            form.render();
        }
    </script>

    <script>
        var $ = layui.$;
        var layer = layui.layer;
        var util = layui.util;
        var form = layui.form;
        layui.use(function () {
            // 事件
            util.on('lay-on', {
                'test-page-customs': function () {
                    layer.open({
                        type: 1,
                        area: '100%',
                        resize: false,
                        shadeClose: true,
                        title: '客户选择',
                        content: `
                        <form class="layui-form" action="">
                            <div class="layui-form">
                                <div class="demo-Search-container">
                                <div class="layui-form-item">
                                    <div class="layui-input-group">
                                        <div class="layui-input-prefix">
                                            客户编码
                                        </div>
                                        <div>
                                            <input id="ClientNos" type="text" placeholder="请输入客户编码" class="layui-input">
                                        </div>

                                        <div class="layui-input-prefix" style="left:50px">
                                            客户名称
                                        </div>
                                        <div style="left:50px">
                                            <input id="ClientNames" type="text" placeholder="请输入客户名称" class="layui-input">
                                        </div>

                                        <div class="layui-input-prefix" style="left:100px">
                                            客户简称
                                        </div>
                                        <div style="left:100px">
                                            <input id="ClientAName" type="text" placeholder="请输入客户简称" class="layui-input">
                                        </div>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <div class="layui-input-group">
                                        <div class="layui-input-prefix" style="left:14px">
                                            客户英文名称
                                        </div>
                                        <dic style="left:14px">
                                            <input id="ClientEname" type="text" placeholder="请输入客户英文名称" class="layui-input">
                                        </dic>

                                        <div class="layui-input-prefix" style="left:77px">
                                            是否启用
                                        </div>
                                        <div style="left:77px;width:197px">
                                            <select id="IsVaild" lay-filter="testSelect">
                                                <option value="-1">是否启用</option>
                                                <option value="0">禁用</option>
                                                <option value="1">启用</option>
                                            </select>
                                        </div>

                                        <div style="left:150px">
                                            <button onclick="ShowSupplier()" id="searchBtn" type="button" class="layui-btn layui-btn-normal">搜索</button>

                                        </div>

                                        <div style="left:170px">
                                            <button onclick="Break()" type="button" class="layui-btn layui-btn-primary">重置</button>
                                        </div>
                                    </div>
                                </div>

                                <table style="left:320px" class="layui-table">
                                    <thead>
                                        <tr>
                                            <td>客户编号</td>
                                            <td>客户名称</td>
                                            <td>客户简称</td>
                                            <td>客户类型</td>
                                            <td>客户电话</td>
                                            <td>客户联系人</td>
                                            <td>客户联系人电话</td>
                                            <td>是否启用</td>
                                            <td>操作</td>
                                        </tr>
                                    </thead>
                                    <tbody id="ClientTable"></tbody>
                                </table>
                                <div id="demo-laypage-alls"></div>
                                </div>
                            </div>
                        </form>

                        `,
                        success: function () {
                            var form = layui.form;
                            var laypage = layui.laypage;
                            var layer = layui.layer;
                            var $ = layui.$;
                            var laydate = layui.laydate;
                            var util = layui.util;

                            var pageIndex = 1;
                            var pageSize = 2;

                            $(function () {
                                ShowSupplier(pageIndex, pageSize);
                            })

                            // 获取客户编码
                            $('#searchBtn').click(function () {
                                var supplier = $('#clientNos').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            // 获取客户名称
                            $('#searchBtn').click(function () {
                                var supplier1 = $('#clientNames').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            //客户简称
                            $('#searchBtn').click(function () {
                                var supplier2 = $('#clientAName').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            // 英文名称
                            $('#searchBtn').click(function () {
                                var supplier2 = $('#clientEname').val();
                                ShowSupplier(pageIndex, pageSize)
                            });
                            //是否启用
                            form.on('select(testSelect)', function (data) {
                                ShowPermission(data.value); // data.value
                            });
                            var clientNo = $("#clientNos").val() || "";
                            var clientName = $("#clientNames").val() || "";
                            var clientAName = $("#clientAName").val() || "";
                            var clientEname = $("#clientEname").val() || "";
                            var isVaild = $("#isVaild").val() || -1;

                            function ShowSupplier(index, size) {
                                $.ajax({
                                    url: '@ViewBag.FoundationWrite' + '/api/Jocker/ClientManagementList',
                                    data: JSON.stringify({ clientNo: clientNo, clientName: clientName, clientAName: clientAName, clientEname: clientEname, isVaild: isVaild, pageIndex: index, pageSize: size }),
                                    type: "post",
                                    async: false,
                                    dataType: "json",
                                    contentType: "application/json",
                                    success: res => {
                                        var tbody = $("#ClientTable");
                                        tbody.empty();
                                        if (res.data != null) {
                                            $.each(res.data, function () {
                                                tbody.append(`<tr>
                                                <td>${this.clientNo}</td>
                                                <td>${this.clientName}</td>
                                                <td>${this.clientAName}</td>
                                                <td>${this.clientTypeName}</td>
                                                <td>${this.clientPhone}</td>
                                                <td>${this.clientContact1}</td>
                                                <td>${this.clientPhone1}</td>
                                                <td>${this.isVaild === 1 ? '启用' : '禁用'}</td>
                                                <td><a onclick="GetClient(${this.clientId},'${this.clientNo}','${this.clientName}')" class="btn btn-link">选择</a></td>
                                                </tr>`);
                                            });
                                        }
                                        form.render(); // 重新渲染下拉框
                                        //完整显示
                                        laypage.render({
                                            elem: 'demo-laypage-alls', // 元素 id
                                            count: res.totalCount, // 数据总数
                                            curr: index,//当前页
                                            limit: size,//每页几条
                                            limits: [2, 3, 4],
                                            layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'], // 功能布局
                                            jump: function (obj, first) {
                                                if (!first) {
                                                    ShowSupplier(obj.curr, obj.limit);
                                                }
                                            }
                                        });
                                    }
                                })
                            }

                            // 对弹层中的表单进行初始化渲染
                            form.render();
                            // 表单提交事件
                            form.on('submit(demo-Search)', function (data) {
                                var field = data.field; // 获取表单字段值

                                // 显示填写结果，仅作演示用
                                // layer.alert(JSON.stringify(field), {
                                //     title: '当前填写的字段值'
                                // });
                                // 此处可执行 Ajax 等操作
                                // …

                                return false; // 阻止默认 form 跳转
                            });
                        }
                    });
                }
            })
        });
        function GetClient(clientId, clientNo, clientName) {
            localStorage.setItem("clientId", clientId);
            $("[name='clientNos']").val(clientNo);
            $("[name='clientNames']").val(clientName);
            layer.close(layer.index); // 关闭弹层
            form.render(); // 重新渲染
        }
    </script>

</body>
</html>


<script>


    layui.use(['form', 'laydate', 'util', 'table'], function () {
        var form = layui.form;
        var laypage = layui.laypage;
        var layer = layui.layer;
        var $ = layui.$;
        var laydate = layui.laydate;
        var util = layui.util;

        var pageIndex = 1;
        var pageSize = 4;
        $(function () {
            ShowSellStock(pageIndex, pageSize);
            // 绑定全选和反选事件
            form.on('checkbox(checkAll)', function (data) {
                if (data.elem.name === 'checkAll') {
                    checkAll();
                }
            });
            form.on('checkbox(check)', function (data) {
                if (data.elem.name === 'check') {
                    checkfan();
                }
            });
        });
        function checkAll() {
            var check = $("[name='check']:eq(0)").prop("checked");
            $("[name='checkAll']:gt(0)").prop("checked", check);
            console.log(check + "123321")

        }
        function checkfan() {
            var length1 = $("[name='check']:gt(0)").length
            var length2 = $("[name='check']:gt(0):checked").length
            var check = lengthl == length2;
            $("[name='checkAll']:eq(0)").prop("checked", check)

        }
        // $(function () {

        //     ShowSellStock(pageIndex, pageSize);
        // })
        // 出库单编号
        $('#searchBtn').click(function () {
            var sellstock = $('#sellStockNo').val();
            ShowSellStock(pageIndex, pageSize)
        });
        // 销售订单号
        $('#searchBtn').click(function () {
            var sellstock1 = $('#sellStockIndent').val();
            ShowSellStock(pageIndex, pageSize)
        });
        //客户名称
        $('#searchBtn').click(function () {
            var sellstock2 = $('#clientName').val();
            ShowSellStock(pageIndex, pageSize)
        });
        // 出库日期
        $('#searchBtn').click(function () {
            var sellstock2 = $('#sellStockTime').val();
            ShowSellStock(pageIndex, pageSize)
        });
        //单据状态
        form.on('select(testSelect)', function (data) {
            ShowPermission(data.value); // data.value
        });
        //销售出库单
        function ShowSellStock(index, size) {
            var table = document.querySelector("table.layui-table tbody");
            var sellStockNo = $("#sellStockNo").val() || "";
            var sellStockIndent = $("#sellStockIndent").val() || "";
            var clientName = $("#clientName").val() || "";
            var sellStockTime = $("#sellStockTime").val() || null;
            var sellStockStart = $("#sellStockStart").val() || -1;
            $.ajax({
                url: '@ViewBag.FoundationRead' + "/api/UserLi/SearchSellStock",
                data: JSON.stringify({ sellStockNo: sellStockNo, sellStockIndent: sellStockIndent, clientName: clientName, sellStockTime: sellStockTime, sellStockStart: sellStockStart, pageIndex: index, pageSize: size }),
                type: "post",
                async: false,
                dataType: "json",
                contentType: "application/json",
                success: res => {
                    var tbody = $("tbody");
                    tbody.empty();
                    if (res.data != null) {
                        $.each(res.data, function () {
                            tbody.append(`<tr>
                            <td><input type="checkbox" class="checked" value="${this.sellStockId}" name="check"/></td>
                            <td>${this.sellStockNo}</td>
                            <td>${this.sellStockName}</td>
                            <td>${this.sellStockIndent}</td>
                            <td>${this.clientNo}</td>
                            <td>${this.clientName}</td>
                            <td>${this.sellStockTime.substr(0, 10).toString("yyyy-MM-dd")}</td>
                            <td>${this.sellStockStart === 0 ? '草稿' : (this.sellStockStart === 1 ? '已确认' : (this.sellStockStart === 2 ? '审批中' : (this.sellStockStart === 3 ? '已审批' : '已完成')))}</td>
                            <td>
                                <a onclick="SellStockUpd('${this.sellStockId}','${this.sellStockNo}')" class="btn btn-link layui-btn-xs" lay-on="test-page-customse"">修改</a>
                                <a onclick="SellStockDel('${this.sellStockId}')" class="btn btn-link">删除</a>
                                <a onclick="SellStockBak('${this.sellStockNo}')" class="btn btn-link">执行出库</a>
                            </td>
                        </tr>`);
                        });
                    }



                    form.render(); // 重新渲染下拉框
                    //完整显示
                    laypage.render({
                        elem: 'demo-laypage-all', // 元素 id
                        count: res.totalCount, // 数据总数
                        curr: index,//当前页
                        limit: size,//每页几条
                        limits: [2, 3, 4],
                        layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'], // 功能布局
                        jump: function (obj, first) {
                            if (!first) {
                                ShowSellStock(obj.curr, obj.limit);
                            }
                        }
                    });
                }
            })
        }

       
        //导出
        function exportTableToExcel() {
            var table = document.querySelector("table.layui-table tbody");
            var ws = XLSX.utils.table_to_sheet(table);
            var wb = XLSX.utils.book_new();
            XLSX.utils.book_append_sheet(wb, ws, "Sheet1");
            XLSX.writeFile(wb, "工作中心列表.xlsx");
        }

        document.querySelector(".layui-btn.layui-bg-blue").addEventListener("click", exportTableToExcel);
    });

   




    $(document).on('click', "#checkAll", function () {
        $(".checked").prop("checked", $("#check").prop("checked"));
    });
   




    function Break() {
        $("#sellStockNo").val("");
        $("#sellStockIndent").val("");
        $("#clientNames").val("");
        $("#sellStockTime").val(null);
        $("#sellStockStart").val(-1);
    }

    //修改销售出库单
    function SellStockUpd(sellStockId, sellStockNo) {
        localStorage['sellStockId'] = sellStockId;
        localStorage['sellStockNo'] = sellStockNo;
        util.on('lay-on', {
            'test-page-customse': function () {
                layer.open({
                    type: 2,
                    title: '销售出库修改',
                    shadeClose: true,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['90%', '90%'],
                    content: '/SellStock/SellStockUpdate',
                });
            },
        });
    }

    //逻辑删除销售出库单
    function SellStockDel(sellStockId) {
        //删除前友好提示
        if (confirm("确定删除吗?")) {
            var data = {
                sellStockId: sellStockId
            };
            $.ajax({
                url: '@ViewBag.FoundationWrite' + "/api/UserLi/DeleteSellStock",
                data: JSON.stringify(data),
                type: 'post',
                async: false,
                dataType: 'json',
                contentType: 'application/json',
                success: res => {
                    if (res.code > 0) {
                        alert("删除成功");
                        location.reload();
                    }
                    else {
                        alert("删除失败");
                    }
                }
            });
        }
    }

    function SellStockBak(sellStockNo) {
        var datec = new Date()
        var year = datec.getFullYear();
        var month = (datec.getMonth() + 1).toString().padStart(2, "0")
        var date = (datec.getDate() + 1).toString().padStart(2, "0")
        var hours = datec.getHours()
        var minute = (datec.getMinutes()).toString().padStart(2, "0")
        var seconds = (datec.getSeconds()).toString().padStart(2, "0")
        // var Encoding = "IF";
        var result = "CK" + year + month + date + hours + minute + seconds;
        //出库前友好提示
        if (confirm("确定出库吗?")) {
            var data = {
                SellStockNo: sellStockNo,
            }
            $.ajax({
                url: '@ViewBag.FoundationWrite' + "/api/UserLi/CreateStockRemoval",
                data: JSON.stringify(data),
                type: 'post',
                async: false,
                dataType: 'json',
                contentType: 'application/json',
                success: res => {
                    if (res.code > 0) {
                        alert("出库成功");
                        location.reload();
                    }
                    else {
                        alert("出库失败");
                    }
                }
            });
        };
    }
</script>



